package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.asm.Label;
import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.TableSwitchInstructionBytecodeEvent;

public class TableSwitchInstructionBytecodeEventImpl extends BytecodeEventImpl implements
    TableSwitchInstructionBytecodeEvent
{
    private int minimumKeyValue;
    private int maximumKeyValue;
    private Label defaultLabel;
    private Label[] blockLabels;

    public TableSwitchInstructionBytecodeEventImpl(final int aMinimumKeyValue, final int aMaximumKeyValue,
        final Label aDefaultLabel, final Label[] aBlockLabels)
    {
        minimumKeyValue = aMinimumKeyValue;
        maximumKeyValue = aMaximumKeyValue;
    }

    @Override
    public int getType() {
        return TABLE_SWITCH_INSTRUCTION;
    }

    @Override
    public void setMinimumKeyValue(final int aMinimumKeyValue) {
        minimumKeyValue = aMinimumKeyValue;
    }

    @Override
    public int getMinimumKeyValue() {
        return minimumKeyValue;
    }

    @Override
    public void setMaximumKeyValue(final int aMaximumKeyValue) {
        maximumKeyValue = aMaximumKeyValue;
    }

    @Override
    public int getMaximumKeyValue() {
        return maximumKeyValue;
    }

    @Override
    public void setDefaultLabel(final Label aDefaultLabel) {
        defaultLabel = aDefaultLabel;
    }

    @Override
    public Label getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public void setBlockLabels(final Label[] aBlockLabels) {
        blockLabels = aBlockLabels;
    }

    @Override
    public Label[] getBlockLabels() {
        return blockLabels;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitTableSwitchInstruction(this);
        return aBytecodeVisitor;
    }
}
